<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html">

    <body>
        <ui:composition template="../templates/default3.xhtml">
            <ui:define name="content">
                <h:form id="viewRMD" binding="#{rawMaterialPurchasingManagerBean.loadViewRMD}">
                    <p:panel header="Raw Material Delivery Details" id="rmdPanel">
                        <table width="100%" border="0">
                            <tr>
                                <td width="200px">Delivery Number:</td>
                                <td>
                                    <h:outputText value="#{rawMaterialPurchasingManagerBean.selectedRawMaterialDelivery.deliveryNumber}" >
                                    </h:outputText>
                                </td>
                            </tr>
                            <tr>
                                <td width="200px">Supplier:</td>
                                <td>
                                    <h:outputText value="#{rawMaterialPurchasingManagerBean.selectedRawMaterialDelivery.supplier.company}" >
                                    </h:outputText>
                                </td>
                            </tr>
                            <tr>
                                <td width="200px">Warehouse Rep.:</td>
                                <td>
                                    <h:outputText value="#{rawMaterialPurchasingManagerBean.selectedRawMaterialDelivery.warehouseRep.name}" >
                                    </h:outputText>
                                </td>
                            </tr>
                            <tr>
                                <td width="200px">Receipt Date:</td>
                                <td>
                                    <h:outputText value="#{rawMaterialPurchasingManagerBean.selectedRawMaterialDelivery.receivedDate}" >
                                        <f:convertDateTime pattern="dd-MMM-yyyy" timeZone="#{defaultManagerBean.tz}"/>
                                    </h:outputText>
                                </td>
                            </tr>
                            <tr>
                                <td width="200px">Expiry Date:</td>
                                <td>
                                    <h:outputText value="#{rawMaterialPurchasingManagerBean.selectedRawMaterialDelivery.expiryDate}" >
                                        <f:convertDateTime pattern="dd-MMM-yyyy" timeZone="#{defaultManagerBean.tz}"/>
                                    </h:outputText>
                                </td>
                            </tr>
                            <tr>
                                <td width="200px">Material:</td>
                                <td>
                                    <h:outputText value="#{rawMaterialPurchasingManagerBean.selectedRawMaterialDelivery.materialRequired.rawMaterial.name}" >
                                    </h:outputText>
                                </td>
                            </tr>
                            <tr>
                                <td width="200px">Amount Remaining (kg / litre):</td>
                                <td>
                                    <h:outputText value="#{rawMaterialPurchasingManagerBean.selectedRawMaterialDelivery.materialRequired.weight}" >
                                    </h:outputText>
                                </td>
                            </tr>
                            <tr>
                                <td width="200px">Storage Zone:</td>
                                <td>
                                    <h:outputText value="#{rawMaterialPurchasingManagerBean.selectedRawMaterialDelivery.warehouseZone.zoneName}" >
                                    </h:outputText>
                                </td>
                            </tr>
                            <tr>
                                <td></td>
                                <td>
                                    <p:commandButton id="btnBackFromViewRMD" value="Back"
                                                     immediate="true" ajax="true"
                                                     title="Go back to the previous page."
                                                     actionListener="#{rawMaterialPurchasingManagerBean.back}"/>
                                    <p:commandButton id="btnRemoveBatchFromWH" value="Remove Batch from Warehouse"
                                                     title="Remove selected raw material batch from warehouse."
                                                     onclick="confirmation.show()" type="button"
                                                     actionListener="#{rawMaterialPurchasingManagerBean.back}"/>
                                </td>
                            </tr>
                        </table>
                    </p:panel>
                    <p:confirmDialog  width="400" message="" header="Removing a batch of raw material" severity="alert" widgetVar="confirmation">
                        <f:facet name="message">
                            <h:outputText value="You are going to remove this batch of raw material from the warehouse."/><br/>
                            <h:outputText value="Are you sure you want to continue?"/>
                        </f:facet>    
                        <p:commandButton value="Yes" update="orderDetailsPanel" onclick="confirmation.hide()"
                                         actionListener="#{rawMaterialPurchasingManagerBean.removeBatchFromWH}"/>
                        <p:commandButton value="No" update="orderDetailsPanel" onclick="confirmation.hide()" type="button" />
                    </p:confirmDialog>
                </h:form>
            </ui:define>
        </ui:composition>
    </body>
</html>
